package com.course.service.impl;

import com.course.entity.ResultBody;
import com.course.mapper.NoticeMapper;
import com.course.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class NoticeServiceImpl implements NoticeService {
    @Autowired
    private NoticeMapper noticeMapper;
    @Override
    public ResultBody sendNotice(Map<String,Object> map) {
        if(noticeMapper.sendNotice(map)>0)
        {
            return new ResultBody(200,"发送成功",true);
        }
        else
            return new ResultBody(500,"发送失败",false);
    }

    public ResultBody lookNotice()
    {
        if(noticeMapper.lookNotice()!=null||noticeMapper.lookNotice()==null)
        return new ResultBody(200,"查询成功",noticeMapper.lookNotice(),noticeMapper.lookNotice().size());
        else
            return new ResultBody(500,"查询失败",false);
    }

    public ResultBody deleteNotice(Map<String,Object> map)
    {
        if(noticeMapper.deleteNotice(map)>0)
        {
            return new ResultBody(200,"删除成功",true);
        }
        else
            return new ResultBody(500,"删除失败",false);
    }

}
